<template>
  <ConfigProvider :locale="locale" :transform-cell-text="transformCellText">
    <router-view />
  </ConfigProvider>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { ConfigProvider } from "ant-design-vue";
import { i18n } from "/@/locales";
import env from "/@/base/env";
// import { getTheme, SlTheme } from "/@/style/theme";
import { isNullOrUndefOrEmpty } from "/@/utils/common";

export default defineComponent({
  components: {
    ConfigProvider,
  },
  setup() {
    let locale: any = null;
    if (i18n && i18n.global) {
      const message = i18n.global.getLocaleMessage(env.lang);
      locale = message.antdLocale;
    }
    function transformCellText({ text }) {
      if (Array.isArray(text)) {
        text = text[0];
      }
      return isNullOrUndefOrEmpty(text) ? "--" : text;
    }
    // ConfigProvider.config({
    //   theme: getTheme(SlTheme.blue),
    // });
    return {
      locale,
      transformCellText,
    };
  },
});
</script>

<style lang="less">
#app {
  width: 100%;
  height: 100%;
}
</style>
